<template>
  <div>
    <ul class="main">
      <user-item
        v-for="item in items"
        :key="item.index"
        :item="item"
        :itemBtn="itemBtn"
        :className="className"
      />
    </ul>
    <button v-if="haveMore" @click="showMore">点击查询更多</button>

    <div v-else>已无更多</div>
  </div>
</template>

<script>
import UserItem from "@/components/userData/UserItem.vue";
export default {
  name: "UserList",
  components: {
    UserItem,
  },
  props: {
    items: Array,
    itemBtn: String,
    className: {
      type: String,
      default: "btn-danger",
    },
    haveMore: Boolean,
  },
  data() {
    return {
      moreShowBoolen: false,
    };
  },
  methods: {
    showMore() {
      console.log("触发回调函数");
      this.$emit("showMore");
    },
  },
};
</script>

<style scoped>
.main {
  overflow: scroll;
  margin-left: 0px;
  height: 280px;
  border: 1px solid #ddd;
  border-radius: 2px;
  padding: 0px;
}

.todo-empty {
  height: 40px;
  line-height: 40px;
  border: 1px solid #ddd;
  border-radius: 2px;
  padding-left: 5px;
  margin-top: 10px;
}
</style>